import aiofiles
from fastapi import UploadFile

DEFAULT_CHUNK_SIZE = 1024 * 1024 * 50  # 50 megabytes


async def save_video(video_file: UploadFile):
    async with aiofiles.open("/file/path/name.mp4", "wb") as f:
        while chunk := await video_file.read(DEFAULT_CHUNK_SIZE):
            await f.write(chunk)
